package cn.topcodes.tcsf.app.web.controller.api;

import cn.topcodes.tcsf.admin.commons.api.domain.ApiResponseEntity;
import cn.topcodes.tcsf.app.domain.entity.AppConfig;
import cn.topcodes.tcsf.app.service.AppConfigService;
import cn.topcodes.tcsf.app.web.controller.api.interceptor.IgnoreAppAuth;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * App配置项
 * @author arjun
 * @date 2021-03-02 14:26
 */
@Api(tags = {"APP配置接口"})
@RestController
@RequestMapping(value = "/api/app/config", produces = "application/json")
public class AppConfigApi {

    @Autowired
    private AppConfigService appConfigService;

    @IgnoreAppAuth
    @ApiOperation("获取APP平台配置")
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public ApiResponseEntity<List<AppConfig>> listByType(
            @RequestParam List<String> appType
    ) {
        return ApiResponseEntity.buildOK(appConfigService.findAllByTypes(appType));
    }
}
